In [10]:
include("utils.jl")
using DiffusionTutorialUtilities
utils = DiffusionTutorialUtilities
A,xy = utils.load_graph_and_coords("four_clusters")
Out[10]:
Results from Matlab
gsqexpmedseed: psivec[14] = 1.333333333333333259e+00
gsqexpmedseed: psivec[13] = 1.476190476190476275e+00
gsqexpmedseed: psivec[12] = 1.567765567765567747e+00
gsqexpmedseed: psivec[11] = 1.653235653235653135e+00
gsqexpmedseed: psivec[10] = 1.751470751470751264e+00
gsqexpmedseed: psivec[ 9] = 1.875735375735375632e+00
gsqexpmedseed: psivec[ 8] = 2.042075208741874981e+00
gsqexpmedseed: psivec[ 7] = 2.276297005463671752e+00
gsqexpmedseed: psivec[ 6] = 2.625926432474050998e+00
gsqexpmedseed: psivec[ 5] = 3.188272027061709313e+00
gsqexpmedseed: psivec[ 4] = 4.188272027061708869e+00
gsqexpmedseed: psivec[ 3] = 6.235340033827135642e+00
gsqexpmedseed: psivec[ 2] = 1.139223338971189214e+01
gsqexpmedseed: psivec[ 1] = 2.948058347427972947e+01
gsqexpmedseed: psivec[ 0] = 1.484029173713986438e+02
We get this seeds right
gsqexpmedseed: pushcoeff[ 1] = 3.356178691466748062e-05
gsqexpmedseed: pushcoeff[ 2] = 8.685049075428625880e-05
gsqexpmedseed: pushcoeff[ 3] = 1.586795676444538244e-04
gsqexpmedseed: pushcoeff[ 4] = 2.362361026912510303e-04
gsqexpmedseed: pushcoeff[ 5] = 3.103314435800159877e-04
gsqexpmedseed: pushcoeff[ 6] = 3.767893298334516077e-04
gsqexpmedseed: pushcoeff[ 7] = 4.346625498821070181e-04
gsqexpmedseed: pushcoeff[ 8] = 4.845174440433207860e-04
gsqexpmedseed: pushcoeff[ 9] = 5.274843527946711285e-04
gsqexpmedseed: pushcoeff[10] = 5.649086973636321517e-04
gsqexpmedseed: pushcoeff[11] = 5.984755160266384171e-04
gsqexpmedseed: pushcoeff[12] = 6.311026859034799853e-04
gsqexpmedseed: pushcoeff[13] = 6.702529765922815227e-04
gsqexpmedseed: pushcoeff[14] = 7.420657955128831919e-04
gsqexpmedseed: pushcoeff[15] = 9.894210606838441113e-04
We seem to get these right too
In [12]:
size(A)
Out[12]:
In [14]:
# what is wrong
# that was the output from the Matlab code
include("diffusions.jl")
using DiffusionAlgorithms
hkvec = DiffusionAlgorithms.hk_relax_solution(A,5.,1,1.e-4)
@printf "hkvec[1] = %.18e\n" hkvec[1]
@printf " true[1] = %.18e\n" 19.359526487166217
@printf "hkvec[1] = %.18e\n" hkvec[2]
@printf " true[1] = %.18e\n" 9.408867012443888
In [23]:
A,xy = utils.load_graph_and_coords("newman-netsci")
include("diffusions.jl")
using DiffusionAlgorithms
pprvec = DiffusionAlgorithms.ppr_push_solution(A,0.99,1,1.e-7)
@printf("True = 0.026124014066724\n")
@printf("x[0] = %.15f\n", pprvec[1]) # Matlab gave 0.026124014066724
In [29]:
#Test sweep cut
A,xy = utils.load_graph_and_coords("four_clusters")
include("diffusions.jl")
using DiffusionAlgorithms
pprvec = DiffusionAlgorithms.ppr_push_solution(A,0.99,1,1.e-7)
DiffusionAlgorithms.degree_normalized_sweep_cut!(A,pprvec)
Out[29]:
In [36]:
#Test sweep cut
A,xy = utils.load_graph_and_coords("four_clusters")
include("diffusions.jl")
using DiffusionAlgorithms
@show bestset,bestcond = DiffusionAlgorithms.ppr_grow(A,1)
@show bestset,bestcond = DiffusionAlgorithms.hk_grow(A,1)
Out[36]: